//////////////////////////////////////////////
// File				:	CRenderer.h
//
// Author			:	Nick Faletra (NF)
//
// Date Created		:	12/19/2013
//////////////////////////////////////////////
#ifndef _RENDERER_H_
#define _RENDERER_H_

#include <d3d9.h>
#include <d3dx9.h>

#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
#pragma comment(lib, "dxguid.lib")

#include "../Utility/Utility.h"

class CRenderer
{
	IDirect3D9*				m_pD3D;
	IDirect3DDevice9*		m_pDevice;
	ID3DXSprite*			m_pSprite;
	ID3DXFont*				m_pFont;
	ID3DXLine*				m_pLine;
	D3DPRESENT_PARAMETERS	m_PresentParams;
	HWND					m_hWnd;

public:
	CRenderer();
	CRenderer(const CRenderer&);
	CRenderer& operator=(const CRenderer&);
	~CRenderer();

	__forceinline LPDIRECT3D9 GetD3D() const { return m_pD3D; }
	__forceinline LPDIRECT3DDEVICE9 GetDevice() const { return m_pDevice; }
	__forceinline LPD3DXSPRITE GetSprite() const { return m_pSprite; }
	__forceinline LPD3DXLINE GetLine() const { return m_pLine; }
	__forceinline const D3DPRESENT_PARAMETERS* GetPresentParams() const { return &m_PresentParams; }

	bool Initialize(HWND, int, int, bool = true, bool = true);
	void Shutdown();
	void Clear(unsigned char = 0, unsigned char = 0, unsigned char = 0);
	bool DeviceBegin();
	bool SpriteBegin();
	bool LineBegin();
	bool DeviceEnd();
	bool SpriteEnd();
	bool LineEnd();
	void Present();
	void ChangeDisplayParam(int, int, bool);

	void DrawRect(RECT, unsigned char, unsigned char, unsigned char);
	void DrawLine(int, int, int, int, unsigned char = 255, unsigned char = 255, unsigned char = 255);
	void DrawText(char*, int, int, unsigned char = 255, unsigned char = 255, unsigned char = 255);
};

#endif // _RENDERER_H_